#include "main.h"

EUART_t          speak_comm;
bool             gb_Rtianmao;
bool             gb_Sendtianmao;
u8               ToFace[3];
//u8               ToTianMiao[80];
bool             gb_tmconnet;
bool             gb_tmrest;
u8               renumber;
u8               respeak;

u8  selmode[]={0xe8, 0xaf, 0xb7, 0xe9, 0x80, 0x89, 0xe6, 0x8b, 0xa9, 0xe5, 0xaf, 0xb9, 0xe5, 0xba, 0x94, 0xe6, 0xa8, 0xa1, 0xe5, 0xbc, 0x8f};

/****************************************
       初始化
 ****************************************/
void Euart_init(void)
{
    speak_comm.sending_f = false;
    speak_comm.recved_f  = false;
    speak_comm.rx_byte_tmr = 0;
    speak_comm.tx_ct = 0;
    speak_comm.rx_ct = 0;
    gb_Rtianmao = 0;
    gb_Sendtianmao = 0;
}
/****************************************
   
 ****************************************/
void Euart_byte_tmr_dn(EUART_t * c_uart)
{
    //uint8_t_dn(&c_uart->rx_byte_tmr);					//
	if (c_uart->rx_byte_tmr)
		c_uart->rx_byte_tmr--;
}
void send_selmode(void)
{
    u16 crc16_temp3 = 0;
	u8 i;	
    speak_comm.tx_buf[0] = 0x5A;
    speak_comm.tx_buf[1] = 0x02;
    speak_comm.tx_buf[2] = 1;//ToTianMiao[1]; //包序号
    speak_comm.tx_buf[3] = 0x02;//ToTianMiao[2]; //包类型
    speak_comm.tx_buf[4] = 0xC0;//ToTianMiao[3]; //控制位
    speak_comm.tx_buf[5] = 0; 
    speak_comm.tx_buf[6] = 0; 
    //数据长度
    speak_comm.tx_buf[7] = 0; 
    speak_comm.tx_buf[8] = 23;//ToTianMiao[0]; 
    speak_comm.tx_buf[9] = 0x20;
    speak_comm.tx_buf[10] = 0x0E;
	for(i=0;i<21;i++)
	{
		speak_comm.tx_buf[i+11] = selmode[i]; //
	}
    crc16_temp3 = crc16_cal(&(speak_comm.tx_buf[1]),speak_comm.tx_buf[8]+8);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+9] = HIBYTE(crc16_temp3);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+10] = LOBYTE(crc16_temp3);       
    speak_comm.tx_buf[speak_comm.tx_buf[8]+11] = 0xA5; //

    speak_comm.sending_f = true;
    speak_comm.tx_ct = 0;
    UART_SendByte(UART0, speak_comm.tx_buf[0]); 
}
/* void send_speak(u8 type)
{
    u16 crc16_temp3 = 0;
	u8 i;	
    u8 length;
	u8 *pter;
    speak_comm.tx_buf[0] = 0x5A;
    speak_comm.tx_buf[1] = 0x02;
    speak_comm.tx_buf[2] = 1;//ToTianMiao[1]; //包序号
    speak_comm.tx_buf[3] = 0x02;//ToTianMiao[2]; //包类型
    speak_comm.tx_buf[4] = 0xC0;//ToTianMiao[3]; //控制位
    speak_comm.tx_buf[5] = 0; 
    speak_comm.tx_buf[6] = 0; 
    //数据长度
    speak_comm.tx_buf[7] = 0; 
    
    speak_comm.tx_buf[9] = 0x20;
    speak_comm.tx_buf[10] = 0x0E;
    length = sizeof(normal);
        
    for(i=0;i<length;i++)
    {
        speak_comm.tx_buf[i+11] = normal[i]; //
    }    
    if(type == 1)
    {

        length += sizeof(speednormal);
        pter = &speednormal;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }   
        length += 1;
        speak_comm.tx_buf[i+11] = number[ToFace[1]]; 
        i++;
        length += sizeof(dang);
        pter = &dang;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        } 
        length = sizeof(normal)+sizeof(speednormal)+1+sizeof(dang)+2;
        
    }
    else if((type == 2)||(type == 3))
    {
        if(ToFace[1] == 0)
        {
            length += sizeof(close);
            pter = &close;          
        }
        else
        {
            length += sizeof(open);
            pter = &open;             
        }
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        } 
        if(type == 2) 
        {
            length += sizeof(screen); 
            pter = &screen;
            for(;i<length;i++)
            {
                speak_comm.tx_buf[i+11] = *pter; //
                pter++;
            } 
        }
        else
        {
            length += sizeof(lock); 
            pter = &lock;
            for(;i<length;i++)
            {
                speak_comm.tx_buf[i+11] = *pter; //
                pter++;
            }            
        }

        length += 2;            
    }
    else if(type == 4)
    {
        if(ToFace[0] == 0x05)
        {
            length = sizeof(lefttime);
            pter = &lefttime;
        }
        else
        {
            length = sizeof(righttime);
            pter = &righttime;            
        }
        for(i=0;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;     
    }
    else if(type == 5)
    {
        length += sizeof(modetime);
        pter = &modetime;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }
    else if(type == 6)
    {
        length += sizeof(modetimeinc);
        pter = &modetimeinc;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }
    else if(type == 7)
    {
        length += sizeof(modetimedec);
        pter = &modetimedec;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }  
    else if(type == 8)
    {
        length += sizeof(modetemper);
        pter = &modetemper;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }
    else if(type == 9)
    {
        length += sizeof(apointstart);
        pter = &apointstart;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }  
    else if(type == 10)
    {
        length += sizeof(apointend);
        pter = &apointend;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }   
    else if(type == 11)
    {
        length += sizeof(setappoint);
        pter = &setappoint;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }  
    else if(type == 12)
    {
        length += sizeof(select_mode);
        pter = &select_mode;
        for(;i<length;i++)
        {
            speak_comm.tx_buf[i+11] = *pter; //
            pter++;
        }    
        length += 2;         
    }                     
    speak_comm.tx_buf[8] = length;//ToTianMiao[0];

    crc16_temp3 = crc16_cal(&(speak_comm.tx_buf[1]),speak_comm.tx_buf[8]+8);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+9] = HIBYTE(crc16_temp3);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+10] = LOBYTE(crc16_temp3);       
    speak_comm.tx_buf[speak_comm.tx_buf[8]+11] = 0xA5; //

    speak_comm.sending_f = true;
    speak_comm.tx_ct = 0;
    SelectSFRBank1();
    SBUF3 = speak_comm.tx_buf[0];
    SelectSFRBank0();   
} */
/****************************************
       发送数据
 ****************************************/
void send_tianmao_comm(void)
{
    u16 crc16_temp3 = 0;
    if(gb_TestFlag)
        return;
	if (gb_Sendtianmao) //100ms
	{
        gb_Sendtianmao = 0;      
        speak_comm.tx_buf[0] = 0x5A;
        speak_comm.tx_buf[1] = 0x02;
        speak_comm.tx_buf[2] = renumber+1;//ToTianMiao[1]; //包序号
        speak_comm.tx_buf[3] = 0x03;//ToTianMiao[2]; //包类型
        speak_comm.tx_buf[4] = 0xC0;//ToTianMiao[3]; //控制位
        speak_comm.tx_buf[5] = 0; 
        speak_comm.tx_buf[6] = 0; 
        //数据长度
        speak_comm.tx_buf[7] = 0; 
        speak_comm.tx_buf[8] = 4;//ToTianMiao[0]; 
        speak_comm.tx_buf[9] = renumber;
        speak_comm.tx_buf[10] = 1;
        speak_comm.tx_buf[11] = 0x01;
        speak_comm.tx_buf[12] = respeak;
        crc16_temp3 = crc16_cal(&(speak_comm.tx_buf[1]),speak_comm.tx_buf[8]+8);
        speak_comm.tx_buf[speak_comm.tx_buf[8]+9] = HIBYTE(crc16_temp3);
        speak_comm.tx_buf[speak_comm.tx_buf[8]+10] = LOBYTE(crc16_temp3);       
        speak_comm.tx_buf[speak_comm.tx_buf[8]+11] = 0xA5; //

        speak_comm.sending_f = true;
        speak_comm.tx_ct = 0;
        UART_SendByte(UART0, speak_comm.tx_buf[0]);
	}
}
void send_handshake_comm(void)
{
    u16 crc16_temp3 = 0;

    speak_comm.tx_buf[0] = 0x5A;
    speak_comm.tx_buf[1] = 0x02;
    speak_comm.tx_buf[2] = 1; //包序号
    speak_comm.tx_buf[3] = 0x01; //包类型
    speak_comm.tx_buf[4] = 0xc0; //控制位
    speak_comm.tx_buf[5] = 0; 
    speak_comm.tx_buf[6] = 0; 
    //数据长度
    speak_comm.tx_buf[7] = 0; 
    speak_comm.tx_buf[8] = 7; 

    speak_comm.tx_buf[9] = 0x00;
    speak_comm.tx_buf[10] = 0x00;
    speak_comm.tx_buf[11] = 0x02;
    speak_comm.tx_buf[12] = 0x00;
    speak_comm.tx_buf[13] = 0x50;//允许下发的最大长度为80字节
    speak_comm.tx_buf[14] = 0x00;
    speak_comm.tx_buf[15] = 0x14;
    
    crc16_temp3 = crc16_cal(&(speak_comm.tx_buf[1]),speak_comm.tx_buf[8]+8);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+9] = HIBYTE(crc16_temp3);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+10] = LOBYTE(crc16_temp3);       
    speak_comm.tx_buf[speak_comm.tx_buf[8]+11] = 0xA5; //

    speak_comm.sending_f = true;
    speak_comm.tx_ct = 0;
    UART_SendByte(UART0, speak_comm.tx_buf[0]);
}
void send_tianmaonet_comm(void)
{
    u16 crc16_temp3 = 0;

    speak_comm.tx_buf[0] = 0x5A;
    speak_comm.tx_buf[1] = 0x02;
    speak_comm.tx_buf[2] = 1; //包序号
    speak_comm.tx_buf[3] = 0x02; //包类型
    speak_comm.tx_buf[4] = 0xc0; //控制位
    speak_comm.tx_buf[5] = 0; 
    speak_comm.tx_buf[6] = 0; 
    //数据长度
    speak_comm.tx_buf[7] = 0; 
    speak_comm.tx_buf[8] = 2; 

    speak_comm.tx_buf[9] = 0x00;
    speak_comm.tx_buf[10] = 0x03;
    
    crc16_temp3 = crc16_cal(&(speak_comm.tx_buf[1]),speak_comm.tx_buf[8]+8);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+9] = HIBYTE(crc16_temp3);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+10] = LOBYTE(crc16_temp3);       
    speak_comm.tx_buf[speak_comm.tx_buf[8]+11] = 0xA5; //

    speak_comm.sending_f = true;
    speak_comm.tx_ct = 0;
    UART_SendByte(UART0, speak_comm.tx_buf[0]);
}
void send_tianmaorest_comm(void)
{
    u16 crc16_temp3 = 0;

    speak_comm.tx_buf[0] = 0x5A;
    speak_comm.tx_buf[1] = 0x02;
    speak_comm.tx_buf[2] = 1; //包序号
    speak_comm.tx_buf[3] = 0x02; //包类型
    speak_comm.tx_buf[4] = 0xc0; //控制位
    speak_comm.tx_buf[5] = 0; 
    speak_comm.tx_buf[6] = 0; 
    //数据长度
    speak_comm.tx_buf[7] = 0; 
    speak_comm.tx_buf[8] = 2; 

    speak_comm.tx_buf[9] = 0x00;
    speak_comm.tx_buf[10] = 0x01;
    
    crc16_temp3 = crc16_cal(&(speak_comm.tx_buf[1]),speak_comm.tx_buf[8]+8);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+9] = HIBYTE(crc16_temp3);
    speak_comm.tx_buf[speak_comm.tx_buf[8]+10] = LOBYTE(crc16_temp3);       
    speak_comm.tx_buf[speak_comm.tx_buf[8]+11] = 0xA5; //

    speak_comm.sending_f = true;
    speak_comm.tx_ct = 0;
    UART_SendByte(UART0, speak_comm.tx_buf[0]);
}
bool link_wind(void)
{
    if(sta_Lfire || sta_Rfire||(bakeCtrl.state == STA_WORK)||(bakeCtrl.state == STA_PAUSE)||(steamCtrl.state == STA_WORK)||(steamCtrl.state == STA_PAUSE)) 
    {
        return 1;
    }
    else
    {
        return 0;
    }
}
u16 time_deal(u16 time_number)
{
    u16 time = 0xffff;
    u16 i;
    if((time_number >= 0x90)&&(time_number <= 0x93))
    {
        time = time_number-0x8F;
    }
    else if(time_number == 0xA1)
    {
        time = 5;
    }
    else if((time_number >= 0x94)&&(time_number <= 0x97))
    {
        time = time_number-0x8E;
    }
    else if(time_number == 0x40)
    {
        time = 10;
    }
    else if(time_number == 0x98)
    {
        time = 11;
    }
    else if(time_number == 0x99)
    {
        time = 12;
    }
    else if((time_number >= 0x100)&&(time_number <= 0x106))
    {
        time = time_number- 0xF3;
    }
    else if((time_number >= 0x41)&&(time_number <= 0x49))
    {
        time = (time_number-0x3F)*10;
    }
    else if(time_number == 0x50)
    {
        time = 110;
    }
    else if(time_number == 0x51)
    {
         time = 120;
    }
    else if((time_number >= 0x74)&&(time_number <= 0x77))
    {
        time = (time_number-0x71)*60;
    }
    else if(time_number == 0x89)//7小时
    {
        time = 420;//(time_number-0x71)*60;
    }
    else if((time_number == 0x78)||(time_number == 0x79))
    {
        time = (time_number-0x70)*60;
    }
    else if((time_number >= 0x80)&&(time_number <= 0x82))
    {
        time = (time_number-0x78)*60;
    }
    else if((time_number&0xA000) == 0xA000)
    {
        i = time_number &0x0fff;
        time = (i/256)*100+((i%256)/16)*10+(i%16);
    }
    return time;

}
/*****************
 接收数据处理
 *****************/
void receive_tianmao_deal(void)
{
    u16 crc16_temp = 0;
    u16 crc16_temp1 = 0;
    u16 crc16_temp2 = 0;
    u8 i;
	u8 rec_cmd = 0;
	u16 rec_part = 0;
    static u16 elen = 0;  
    static u8 RTMML0 = 0;//对象
    static u8 RTMML1 = 0;//动作      
    if(speak_comm.recved_f)
    {
        speak_comm.recved_f = 0;
        elen = MAKEWORD(speak_comm.rx_buf[7],speak_comm.rx_buf[8]);
		crc16_temp1 = crc16_cal(&(speak_comm.rx_buf[1]),elen+8);
        crc16_temp2 = MAKEWORD(speak_comm.rx_buf[elen+9],speak_comm.rx_buf[elen+10]); 
        if(crc16_temp1 == crc16_temp2)   
        {
            // gb_Rtianmao = 1;
            // ToFace[0] = elen;
            // ToFace[1] = speak_comm.rx_buf[2]; //包序号
            // ToFace[2] = speak_comm.rx_buf[3];//包类型
            // ToFace[3] = speak_comm.rx_buf[4];//控制位
            // for(i = 4;i<(4+elen);i++)
            // {
            //     ToFace[i] = speak_comm.rx_buf[i+5];
            // }
            renumber = speak_comm.rx_buf[2];
            ToFace[0] = 0;
            ToFace[1] = 0;	
            ToFace[2] = 0;            
            switch(speak_comm.rx_buf[3])//包类型
            {
                case 0://握手请求包
                {
                    send_handshake_comm();
                }
                break;
                case 0x03://配网回复
                {
                    gb_tmconnet = 0;
                }
                break;
                case 0x02:
                {
                    if(elen == 2)
                    {
                        if((speak_comm.rx_buf[9] == 0x10)&&(speak_comm.rx_buf[10] == 0x04))
                        {
                            ToFace[0] = 0xff;
                            ToFace[1] = 0x01;   
                        }
                        else if((speak_comm.rx_buf[9] == 0x10)&&(speak_comm.rx_buf[10] == 0x02))
                        {
                             ToFace[0] = 0xff;
                             ToFace[1] = 0x00;                              
                        }                     
                        return;
                    }
                    else if(elen == 3)
                    {
                        if(wall_L.on_f||wall_R.on_f)
                        {
                            return;
                        }
                        if(cut_stove_f)
                        {
                            if(!((speak_comm.rx_buf[9] == 0xA0)&&(speak_comm.rx_buf[10] == 0x00)&&(speak_comm.rx_buf[11] == 0x02)))
                            {
                                gb_Sendtianmao = 1;
                                respeak = PROMRT_SHUAIFENG_LOCKREMIND;
                                send_tianmao_comm();                                  
                                return; //童锁打开不可操作
                            }
                        }
                        if((speak_comm.rx_buf[9] == 0)&&(speak_comm.rx_buf[10] == 0))
                        {
                            switch(speak_comm.rx_buf[11])
                            {
                                case 0x01://打开风机
                                {
                                    ToFace[0] = 0x01;
                                    ToFace[1] = 5;
                                    gb_Sendtianmao = 1;
                                    respeak = PROMPT_SHUAIFENG_OPEN_FAN_MP3;
                                }
                                break;
                                case 0x02://关闭风机
                                { 
                                    ToFace[0] = 0x01;
                                    ToFace[1] = 0x00;                                                                         
                                    if(link_wind())
                                    {
                                        return;
                                    }
                                    else
                                    {
                                        gb_Sendtianmao = 1;  
                                        respeak = PROMPT_SHUAIFENG_CLOSE_FAN_MP3;                                      
                                    }                         
                                }
                                break;
                                case 0x03:case 0x04:case 0x05:case 0x06://风速档位1-8       
                                case 0x07:case 0x08:case 0x09:case 0x10:
                                {
                                    ToFace[0] = 0x01;
									if(speak_comm.rx_buf[11] == 0x10)
										ToFace[1] = 8;
									else
										ToFace[1] = speak_comm.rx_buf[11]-2;                                    
                                    if(speak_comm.rx_buf[11] == 0x03)
                                    {
                                        if(sta_Lfire || sta_Rfire)
                                        {
                                            return;
                                        }
                                    }
                                    //send_speak(1);
                                    gb_Sendtianmao = 1;  
                                    respeak = ToFace[1]+219;                                   
                                }
                                break;
                                case 0x18://档位调大
                                {
                                    ToFace[0] = 0x02;
                                    ToFace[1] = 1;                                      
                                    if(smoker.level)
                                    {
                                        gb_Sendtianmao = 1;  
                                        respeak = PROMPT_SHUAIFENG_TURNUP_GEAR_MP3;
                                    }
     
                                }
                                break;
                                case 0x19://档位调小
                                {
                                    ToFace[0] = 0x02;
                                    ToFace[1] = 2;                                     
                                    if((smoker.level <= 2)&&(sta_Lfire || sta_Rfire))
                                    {
                                        return;
                                    }
                                    if((smoker.level == 1)&& link_wind())
                                    {
                                        return;
                                    }                                    
                                    if(smoker.level)
                                    {  
                                        gb_Sendtianmao = 1;  
                                        respeak = PROMPT_SHUAIFENG_TURNDOWN_GEAR_MP3;
                                    }
                                     
                                }
                                break;
                                case 0x20://延时两分钟
                                case 0x21://延时三分钟
                                case 0x22://延时五分钟
                                {
                                    if(link_wind())
                                        return;
                                    if(smoker.level)
                                    {                                
                                        ToFace[0] = 0x03;
                                        if(speak_comm.rx_buf[11] == 0x20)
                                        {
                                            ToFace[1] = 2;                                           
                                            respeak = PROMPT_SHUAIFENG_DELAY_TWO_MINUTES_MP3;
                                        }
                                        else if(speak_comm.rx_buf[11] == 0x21)
                                        {
                                            ToFace[1] = 3;
                                            respeak = PROMPT_SHUAIFENG_DELAY_THREE_MINUTES_MP3; 
                                        }
                                        else
                                        {
                                            ToFace[1] = 5; 
                                            respeak = PROMPT_SHUAIFENG_DELAY_FIVE_MINUTES_MP3;
                                        }
                                        gb_Sendtianmao = 1; 
                                    } 
                                }
                                break;
                                case 0x23://取消延时
                                {
                                    ToFace[0] = 0x03;
                                    ToFace[1] = 0;                                      
                                    if(smoker.level)  
                                    {                                     
                                        gb_Sendtianmao = 1;  
                                        respeak = PROMPT_SHUAIFENG_CANCEL_DELAY_MP3;
                                    }

                                }
                                break;
                                case 0x25://左灶熄火
                                {
                                    ToFace[0] = 0x04;
                                    ToFace[1] = 0;   
                                    gb_Sendtianmao = 1;  
                                    respeak = PROMPT_SHUAIFENG_XIMEI_LEFTFOCUS_MP3;
                                }
                                break;
                                case 0x26://右灶熄火
                                {
                                    ToFace[0] = 0x04;
                                    ToFace[1] = 1;   
                                    gb_Sendtianmao = 1;  
                                    respeak = PROMPT_SHUAIFENG_XIMEI_RIGHTFOCUS_MP3;
                                }
                                break;
                                case 0x27://取消左灶定时
                                {
                                    ToFace[0] = 0x05;
                                    ToFace[1] = 0;   
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_CANCEL_TIMING_LEFTFOCUS_MP3;
                                }
                                break;
                                case 0x28://取消右灶定时
                                {
                                    ToFace[0] = 0x06;
                                    ToFace[1] = 0;   
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_CANCEL_TIMING_RIGHTFOCUS_MP3;
                                }
                                break;
                                case 0xA8://关闭屏幕
                                {
                                    ToFace[0] = 0x07;
                                    ToFace[1] = 0;                                       
                                    if(sta_Lfire || sta_Rfire)
                                        return;                                      
                                    //send_speak(2);
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_CLOSESCREEN_MP3;
                                }
                                break;
                                case 0xA7://打开屏幕
                                {
                                    ToFace[0] = 0x07;
                                    ToFace[1] = 1;   
                                    //send_speak(2);
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_OPENSCREEN_MP3;
                                }
                                break;
                                case 0xB3://打开左灶定时
                                {
                                    ToFace[0] = 0x08;
                                    ToFace[1] = 0;   
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_TIMING_LEFTFOCUS_MP3;
                                }
                                break;
                                case 0xB4://打开右灶定时
                                {
                                    ToFace[0] = 0x09;
                                    ToFace[1] = 0;   
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_TIMING_RIGHTFOCUS_MP3;
                                }
                                break;
                                case 0xA3://蒸箱工作
                                {
                                    
                                    ToFace[0] = 0x50;
                                    ToFace[1] = 1;                                       
                                    if(steamPara.tempr_set == 0)
                                    {
                                        send_selmode();
                                        return;
                                    }
                                    else
                                    {
                                        gb_Sendtianmao = 1; 
                                        respeak =  PROMPT_SHUAIFENG_OPENWORK_STEAMER_MP3;
                                    }
                                }
                                break;
                                case 0xA4://停止蒸箱
                                {
                                    ToFace[0] = 0x50;
                                    ToFace[1] = 2;                                       
                                    if(steamCtrl.state == STA_NULL)
                                    {
                                        return;
                                    }
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_ENDWORK_STEAMER_MP3;                                    
                                }
                                break;
                                case 0xA5://蒸箱暂停工作
                                {
                                    ToFace[0] = 0x50;
                                    ToFace[1] = 3;                                      
                                    if((steamCtrl.state == STA_NULL))
                                    {
                                        return;
                                    } 
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_SUSPENDWORK_STEAMER_MP3;  
                                }
                                break;
                                case 0xA6://蒸箱继续工作
                                {
                                    ToFace[0] = 0x50;
                                    ToFace[1] = 4;                                      
                                    if((steamCtrl.state >= STA_WORK)&&(door.sta == 0))//&& (gb_DryFireFlag == 0)&&(waterbox.sta == 0)
                                    { 
                                        gb_Sendtianmao = 1;  
                                        respeak =  PROMRT_SHUAIFENG_WORKKEEPON_MPS; 
                                    } 
                                }
                                break;
                                case 0xB1://预约开始
                                {
                                    ToFace[0] = 0x60;
                                    ToFace[1] = 20;                                      
                                    if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set)))
                                    { 
                                        //send_speak(9);
                                        gb_Sendtianmao = 1;  
                                        respeak =  PROMRT_SHUAIFENG_APPOINTS_MPS;  
                                    }

                                }
                                break;
                                case 0xB2://预约结束
                                {
                                    ToFace[0] = 0x60;
                                    ToFace[1] = 30;                                       
                                    if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set)))
                                    {
                                        gb_Sendtianmao = 1;  
                                        respeak =  PROMRT_SHUAIFENG_APPOINTEND_MPS;  
                                        //send_speak(10);
                                    }
                                }
                                break;
                                case 0xA2://取消预约
                                {
                                    ToFace[0] = 0x60;
                                    ToFace[1] = 40;                                       
                                    if((steamCtrl.state == STA_APPOINT)||((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||(bakeCtrl.state == STA_APPOINT)||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set)))
                                    {
                                        gb_Sendtianmao = 1;  
                                        respeak =  PROMPT_SHUAIFENG_CANCEL_APPOINT_MP3;
                                    }
                                }  
                                break;   
                                case 0xB6:case 0xB7:case 0xB8:case 0xB9://模式选择
                                {
                                    if((speak_comm.rx_buf[11] == 0xB6)||(speak_comm.rx_buf[11] == 0xB7))
                                    {
                                        ToFace[0] = 0x70;
                                        ToFace[1] = speak_comm.rx_buf[11]- 0xB6;                                         
                                        if((steamCtrl.state == STA_NULL)||(bakeCtrl.state == STA_NULL))
                                        {
                                            //send_speak(12);   
                                            gb_Sendtianmao = 1;  
                                            respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;                                              
                                        }
                                    }
                                    else 
                                    {
                                        ToFace[0] = 0x70;
                                        ToFace[1] = speak_comm.rx_buf[11]- 0xB6;   
                                        if(bakeCtrl.state == STA_NULL)
                                        {
                                            //send_speak(12); 
                                            gb_Sendtianmao = 1;  
                                            respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;  
                                        }
                                    }
                                }  
                                break; 
                                case 0xC1:case 0xC2:case 0xC3:case 0xC4:case 0xC7:case 0xC8:case 0xC9:
                                {
                                    if(speak_comm.rx_buf[11] <= 0xC3)
                                    {
                                        ToFace[0] = 0x70;
                                        ToFace[1] = speak_comm.rx_buf[11]- 0xC1+4;                                         
                                        if(bakeCtrl.state == STA_NULL)
                                        {
                                            //send_speak(12);                      
                                            gb_Sendtianmao = 1;  
                                            respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;                                            
                                        }
                                    }
                                    else if(speak_comm.rx_buf[11] == 0xC4)
                                    {
                                        ToFace[0] = 0x70;
                                        ToFace[1] = 7;                                          
                                        if((bakeCtrl.state == STA_NULL)||(steamCtrl.state == STA_NULL))
                                        {  
                                            //send_speak(12);                   
                                            gb_Sendtianmao = 1;  
                                            respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;                                            
                                        }                                        
                                    }
                                    else
                                    {
                                        ToFace[0] = 0x70;
                                        ToFace[1] = speak_comm.rx_buf[11]- 0xC7+8;                                        
                                        if(steamCtrl.state == STA_NULL)
                                        {
                                            //send_speak(12); 
                                            gb_Sendtianmao = 1;  
                                            respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;
                                        }
                                    }

                                }  
                                break;
                                case 0xD1:case 0xD2:case 0x36://case 0xD4:case 0xD5:
                                {
                                    ToFace[0] = 0x70;
                                    if(speak_comm.rx_buf[11] == 0x36)
                                        ToFace[1] = 22;
                                    else
                                        ToFace[1] = speak_comm.rx_buf[11]- 0xD1+11;                                    
                                    if(steamCtrl.state == STA_NULL)
                                    {
                                        // if(speak_comm.rx_buf[11] <= 0xD2)
                                        //     ToFace[1] = speak_comm.rx_buf[11]- 0xD1+11;   
                                        // else
                                        //     ToFace[1] = speak_comm.rx_buf[11]- 0xD4+13;
                                        //send_speak(12); 
                                        gb_Sendtianmao = 1;  
                                        respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;
                                    }
                                }    
                                break;                  
                                default:
                                break;
                            }

                        }                        
                        else if((speak_comm.rx_buf[9] == 0)&&(speak_comm.rx_buf[10] == 0x01))
                        {
                            ToFace[0] = 0x0C;
                            if(speak_comm.rx_buf[11] == 0x08)//打开照明
                            {
                                
                                ToFace[1] = 0x01;
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_OPEN_LIGHTING_MP3; 
                            }
                            else if(speak_comm.rx_buf[11] == 0x09)//关闭照明
                            {
                                ToFace[1] = 0x00;
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_CLOSE_LIGHTING_MP3; 
                            }
                        }
                        else if((speak_comm.rx_buf[9] == 0xA0)&&(speak_comm.rx_buf[10] == 0x00))
                        {
                            
                            if(speak_comm.rx_buf[11] == 0x01)//打开童锁
                            {
                                ToFace[0] = 0x0A;
                                ToFace[1] = 0x01;
                                //send_speak(3);
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_OPENLOCK_MP3;
                                                                
                            }
                            else if(speak_comm.rx_buf[11] == 0x02)//关闭童锁
                            {  
								ToFace[0] = 0x0A;								
                                ToFace[1] = 0x00;
                                //send_speak(3);
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_CLOSELOCK_MP3;                                                                   
                            }
                            else if((speak_comm.rx_buf[11] == 0x16)||((speak_comm.rx_buf[11]>= 0x18)&&(speak_comm.rx_buf[11]<= 0x20)))
                            {
                                
                                ToFace[0] = 0x70;
                                switch(speak_comm.rx_buf[11])
                                {
                                    case 0x16:
                                        ToFace[1] = 23; //启动清洁  
                                    break;
                                    case 0x18:
                                        ToFace[1] = 30;//启动蒸箱清洁
                                    break;
                                    case 0x19:
                                        ToFace[1] = 31;//启动蒸箱除菌
                                    break;
                                    case 0x20:
                                        ToFace[1] = 32;//蒸箱解冻
                                    break;
                                    default:
                                    break;

                                }               
                                if(steamCtrl.state == STA_NULL)
                                {
                                    //send_speak(12); 
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;
                                }      
                            }
                            else if((speak_comm.rx_buf[11] == 0x17)||(speak_comm.rx_buf[11] == 0x23)||(speak_comm.rx_buf[11] == 0x25)||((speak_comm.rx_buf[11] >= 0x43)&&(speak_comm.rx_buf[11] <= 0x49)))
                            {
                                ToFace[0] = 0x70;
                                if(speak_comm.rx_buf[11] == 0x17)
                                    ToFace[1] = 29;    //启动保温   
                                else if(speak_comm.rx_buf[11] == 0x23)  
                                    ToFace[1] = 35;
                                else if(speak_comm.rx_buf[11] == 0x25)  
                                    ToFace[1] = 37;
                                else 
                                {
                                    ToFace[1] = speak_comm.rx_buf[11] - 29;
                                }
                                if(bakeCtrl.state == STA_NULL)
                                {
                                    //send_speak(12); 
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;
                                }                                    
                            }
    /*                         else if(speak_comm.rx_buf[11] == 0x03)//自动模式
                            {
                                ToFace[0] = 0x0B;
                                ToFace[1] = 0x01;
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_OPENXIAODUGUI_MP3;                                  
                            }
                            else if(speak_comm.rx_buf[11] == 0x04)//消毒模式
                            {
                                ToFace[0] = 0x0B;
                                ToFace[1] = 0x02;
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_WORKXIAODU_MP3;                                 
                            }
                            else if(speak_comm.rx_buf[11] == 0x05)//烘干模式
                            {
                                ToFace[0] = 0x0B;
                                ToFace[1] = 0x02;
                                gb_Sendtianmao = 1;                                
                                respeak = PROMPT_SHUAIFENG_WORKDRY_MP3;
                            } */
                            else if(speak_comm.rx_buf[11] == 0x06)//烤箱工作
                            {
                                ToFace[0] = 0x50;
                                ToFace[1] = 0x05;                                
                                if(bakePara.tempr_set == 0)
                                {
                                    send_selmode();
                                }
                                else
                                {
                                    gb_Sendtianmao = 1;                                
                                    respeak = PROMPT_SHUAIFENG_OPENWORK_STEAMER_MP3;   
                                }
                             
                            }
                            else if(speak_comm.rx_buf[11] == 0x07)//停止烤箱
                            {
                                ToFace[0] = 0x50;
                                ToFace[1] = 0x06;                                
                                if(bakeCtrl.state == STA_NULL)
                                {
                                    return;
                                }                                
                                gb_Sendtianmao = 1;                                
                                respeak = PROMPT_SHUAIFENG_ENDWORK_STEAMER_MP3;                                  
                            }
                            else if(speak_comm.rx_buf[11] == 0x08)//烤箱暂停工作
                            {
                                ToFace[0] = 0x50;
                                ToFace[1] = 0x07;                                
                                if(bakeCtrl.state == STA_NULL)
                                {
                                    return;
                                }                                
                                gb_Sendtianmao = 1;                                
                                respeak = PROMPT_SHUAIFENG_SUSPENDWORK_STEAMER_MP3;                                    
                            }
                            else if(speak_comm.rx_buf[11] == 0x09)//烤箱继续工作
                            {
                                ToFace[0] = 0x50;
                                ToFace[1] = 0x08;                                
                                if(((bakeCtrl.state == STA_PAUSE)&&(doorbake.sta == 0))||(bakeCtrl.state == STA_APPOINT))
                                {
                                    gb_Sendtianmao = 1;                                
                                    respeak = PROMRT_SHUAIFENG_WORKKEEPON_MPS;  
                                }
                                 
                            }
                        }
                        else if((speak_comm.rx_buf[9] == 0xF0)&&(speak_comm.rx_buf[10] == 0x00))
                        {
                            if(speak_comm.rx_buf[11] == 0x06)
                            {
                                ToFace[0] = 0x01;
                                ToFace[1] = 9;                               
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_OPEN_FAN_MP3;                                                         
                            }
                            else if((speak_comm.rx_buf[11] == 0x11)||(speak_comm.rx_buf[11] == 0x12))
                            {
                                ToFace[0] = 0x70;
                                ToFace[1] = speak_comm.rx_buf[11]+ 0x1C;                                         
                                if((steamCtrl.state == STA_NULL))
                                {  
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMRT_SHUAIFENG_SETMODE_MP3;                                              
                                }                                
                            }
                        }
                    }
                    else if(elen == 6)
                    {
                        if(wall_L.on_f||wall_R.on_f)
                        {
                            return;
                        }
                        if(cut_stove_f)
                        {
                            gb_Sendtianmao = 1;
                            respeak = PROMRT_SHUAIFENG_LOCKREMIND;
                            send_tianmao_comm();                              
                            return; //童锁打开不可操作
                        }  
                        for(i = 0 ; i < 2; i++)
                        {
                            if(i == 0)
                            {
                                if((speak_comm.rx_buf[9] == 0)&&(speak_comm.rx_buf[10] == 0))
                                {
                                    rec_cmd = speak_comm.rx_buf[11];                           
                                    rec_part = MAKEWORD(speak_comm.rx_buf[13],speak_comm.rx_buf[14]);
                                } 
                                else 
                                    i = 1;  
                            }
                            if(i == 1)
                            {
                                if((speak_comm.rx_buf[12] == 0)&&(speak_comm.rx_buf[13] == 0))     
                                {
                                    rec_cmd = speak_comm.rx_buf[14];
                                    rec_part = MAKEWORD(speak_comm.rx_buf[10],speak_comm.rx_buf[11]);                            
                                } 
                            }
                                                                    
                            if((rec_cmd == 0x25)||(rec_cmd == 0x26))//左灶定时设置
                            {
                                respeak = 0;
                                gb_Sendtianmao = 1;
                                if(rec_cmd == 0x25) //左灶
                                {
                                    if(sta_Lfire == 0)
                                    {
                                        respeak = PROMRT_SHUAIFENG_NOFIRE;
                                    }
                                    else
                                    {                                     
                                        respeak = PROMPT_SHUAIFENG_LEFTTIME_MP3;
                                    }
                                    ToFace[0] = 0x05;
                                }                                   
                                else
                                {
                                    if(sta_Rfire == 0)
                                    {
                                        respeak = PROMRT_SHUAIFENG_NOFIRE;
                                    }   
                                    else
                                    {
                                        respeak = PROMRT_SHUAIFENG_RIGHTTIME_MP3;
                                    }                                    
                                    ToFace[0] = 0x06;                                                                       
                                }
                                crc16_temp = 0;
                                crc16_temp = time_deal(rec_part);
                                if(crc16_temp > 180)
                                    crc16_temp = 180;
                                ToFace[1] = crc16_temp & 0xFF;
                                ToFace[2] = crc16_temp>>8;
                            }
                            else if(rec_cmd == 0x37)	//时间设置
                            {
                                ToFace[0] = 0x10;
                                crc16_temp = time_deal(rec_part);
                                ToFace[1] = crc16_temp&0xff;
                                ToFace[2] = crc16_temp>>8;
                                if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||(steamCtrl.state == STA_PAUSE)||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set))||(bakeCtrl.state == STA_PAUSE))   
                                {
                                    //send_speak(5);
                                    gb_Sendtianmao = 1;
                                    respeak = PROMRT_SHUAIFENG_SETTIME_MP3;
                                }                                  
                                // if(((rec_part >= 0x40)&&(rec_part <= 0x49))||(rec_part == 0x50)||(rec_part == 0xA120))//0x51
                                // {
                                //     ToFace[0] = 0x10;
                                //     if(rec_part <= 0x49)
                                //         ToFace[1]=( rec_part - 0x40 +1)*10;
                                //     else if(rec_part == 0xA120)
                                //         ToFace[1] = 120;
                                //     else if(rec_part == 0x50)  
                                //     {
                                //         ToFace[1] = 110;
                                //     }                                  
                                //     if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||(steamCtrl.state == STA_PAUSE)||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set))||(bakeCtrl.state == STA_PAUSE))   
                                //     {
                                //         //send_speak(5);
                                //         gb_Sendtianmao = 1;
                                //         respeak = PROMRT_SHUAIFENG_SETTIME_MP3;
                                //     }                                
                                // }

                            } 
                            else if((rec_cmd == 0x38)||(rec_cmd == 0x39))  //时间加   时间减
                            {
                                if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||(steamCtrl.state == STA_PAUSE)||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set))||(bakeCtrl.state == STA_PAUSE))
                                { 
                                    gb_Sendtianmao = 1;  
                                    if(rec_cmd == 0x38)
                                    {
                                        respeak = PROMRT_SHUAIFENG_ADDTIME_MP3;
                                        ToFace[0] = 0x20;
                                    }
                                    else
                                    {
                                        respeak = PROMRT_SHUAIFENG_DECTIME_MP3;
                                        ToFace[0] = 0x30;                                        
                                    }
                                    crc16_temp = time_deal(rec_part);
                                    ToFace[1] = crc16_temp&0xff;
                                    ToFace[2] = crc16_temp>>8;  
                                }                              
                                // if((rec_part== 0xA1)||((rec_part >= 0x40)&&(rec_part <= 0x45)))
                                // { 
                                //     if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||(steamCtrl.state == STA_PAUSE)||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set))||(bakeCtrl.state == STA_PAUSE))   
                                //     {
                                //        // send_speak(6);
                                //         gb_Sendtianmao = 1;
                                //         if(rec_cmd == 0x38)
                                //         {
                                //             respeak = PROMRT_SHUAIFENG_ADDTIME_MP3;
                                //             ToFace[0] = 0x20;
                                //         }
                                //         else
                                //         {
                                //             respeak = PROMRT_SHUAIFENG_DECTIME_MP3;
                                //             ToFace[0] = 0x30;                                        
                                //         }
                                //         if(rec_part == 0xA1) 
                                //         {
                                //             ToFace[1] = 5;
                                //         }
                                //         else
                                //             ToFace[1]=( rec_part - 0x40 +1)*10;
                                //     }                                                           

                                // }
                            }    
                            else if(rec_cmd == 0x84)  //温度设置
                            {
                                if((rec_part >= 0x52)&&(rec_part <= 0x73))
                                {
                                    ToFace[0] = 0x40;       
                                    ToFace[1]= (((rec_part/16)*10+ rec_part%16)-48)*10;                                     
                                    if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||(steamCtrl.state == STA_PAUSE)
                                    ||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set))||(bakeCtrl.state == STA_PAUSE)) 
                                    {
                                        //send_speak(8);
                                        gb_Sendtianmao = 1;
                                        respeak = PROMRT_SHUAIFENG_SETTEMPER_MP3;   
                                    }                      
                                }
                            }
                            else if(rec_cmd == 0x88)//预约时间
                            {
                                if(((rec_part >= 0x45)&&(rec_part <= 0x82))||(rec_part == 0x89)||(rec_part == 0xA120)||(rec_part == 0xA180)||(rec_part == 0xA240)||(rec_part == 0xA300))
                                {
                                    ToFace[0] = 0x60;
                                    if(rec_part == 0x45)     
                                    {                                                                                                                    
                                        ToFace[1]= 1;                                     
                                    }   
                                    else if(rec_part == 0x51) 
                                    {   
                                        ToFace[1]= 2;                                          
                                    }    
                                    else if((rec_part >= 0x74)&&(rec_part <= 0x77))     
                                    {  
                                        ToFace[1]= rec_part- 0x71;                                     
                                    }   
                                    else if(rec_part == 0x89) 
                                    {  
                                        ToFace[1]= 7;                                      
                                    } 
                                    else if((rec_part >= 0x78)&&(rec_part <= 0x82))  
                                    {  
                                        ToFace[1]= (((rec_part/16)*10+ rec_part%16)-70);                                         
                                    }                                     
                                    else if(rec_part == 0xA120)    
                                    {
                                        ToFace[1]= 2;   
                                    }        
                                    else if(rec_part == 0xA180)  
                                    {
                                        ToFace[1]= 3;
                                    }    
                                    else if(rec_part == 0xA240)  
                                    {
                                        ToFace[1]= 4;
                                    }                                           
                                    else if(rec_part == 0xA300) 
                                    {
                                        ToFace[1]= 5;
                                    }
                                    if(((steamCtrl.state == STA_NULL)&&(steamPara.tempr_set))||((bakeCtrl.state == STA_NULL)&&(bakePara.tempr_set))) 
                                    {                                                                                  
                                        gb_Sendtianmao = 1;
                                        respeak = PROMRT_SHUAIFENG_APPOINTTIME_MPS;                                                                             
                                    } 
                                }    
                            }           

                        }                     
                    }
                }
                break;
                case 0x04:
                {
                    renumber = speak_comm.rx_buf[2];
                    RTMML0 = speak_comm.rx_buf[25]+speak_comm.rx_buf[26]+speak_comm.rx_buf[27]+speak_comm.rx_buf[28]+speak_comm.rx_buf[29]+speak_comm.rx_buf[30];//对象
                    RTMML1 = speak_comm.rx_buf[45]+speak_comm.rx_buf[46]+speak_comm.rx_buf[47]+speak_comm.rx_buf[48]+speak_comm.rx_buf[49]+speak_comm.rx_buf[50];//动作
                    if(cut_stove_f)
                    {
                        if(RTMML0 != 0x35)
                            return; //童锁打开不可操作
                    }
                    if(RTMML0 == 0x45)//烟机
                    {
                        if(RTMML1 == 0x23)//打开
                        {
                            ToFace[0] = 0x01;
                            ToFace[1] = 5;
                            gb_Sendtianmao = 1;
                            respeak = PROMPT_SHUAIFENG_OPEN_FAN_MP3;
                        }
                        else if(RTMML1 == 0x4A)//关闭
                        {
                            ToFace[0] = 0x01;
                            ToFace[1] = 0x00;                              
                            //无火才可以关闭风机
                            if((sta_Lfire == 0)&&(sta_Rfire == 0))
                            {     
                                gb_Sendtianmao = 1;  
                                respeak = PROMPT_SHUAIFENG_CLOSE_FAN_MP3;  
                            }
                            else
                                return;
                        }

                    }
                    else if(RTMML0 == 0x22)//风速
                    {
                        if(RTMML1 == 0x55)//增大
                        {
                            ToFace[0] = 0x02;
                            ToFace[1] = 1;                               
                            if(smoker.level)
                            {
                                gb_Sendtianmao = 1;  
                                respeak = PROMPT_SHUAIFENG_TURNUP_GEAR_MP3;
                            }
                        }
                        else if(RTMML1 == 0x1F)//减小
                        {
                            ToFace[0] = 0x02;
                            ToFace[1] = 2;                               
                            if(smoker.level)
                            {
                                gb_Sendtianmao = 1;  
                                respeak = PROMPT_SHUAIFENG_TURNDOWN_GEAR_MP3;
                            }
                        }

                    }
                    else if(RTMML0 == 0x1F)//照明
                    {           
                        if(RTMML1 == 0x23)//打开
                        {
                            ToFace[0] = 0x0C;
                            ToFace[1] = 0x01;
                            gb_Sendtianmao = 1;
                            respeak = PROMPT_SHUAIFENG_OPEN_LIGHTING_MP3; 
                        }
                        else if(RTMML1 == 0x4A)//关闭
                        {

                            ToFace[0] = 0x0C;
                            ToFace[1] = 0x00;
                            gb_Sendtianmao = 1;
                            respeak = PROMPT_SHUAIFENG_CLOSE_LIGHTING_MP3; 
                        }                
                    }
                    else if(RTMML0 == 0x35)//童锁
                    {                
                        if(RTMML1 == 0x23)//打开
                        {
                            //if(cut_stove_f == 0)
                            {
                                ToFace[0] = 0x0A;
                                ToFace[1] = 0x01;
                                //send_speak(3);
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_OPENLOCK_MP3;
                            }   
                        }
                        else if(RTMML1 == 0x4A)//关闭
                        {
                            //if(cut_stove_f == 1)
                            {                               
                                ToFace[0] = 0x0A;
                                ToFace[1] = 0x00;
                                //send_speak(3);
                                gb_Sendtianmao = 1;
                                respeak = PROMPT_SHUAIFENG_CLOSELOCK_MP3;   
                            }     
                        }
                    }  
                    else if(RTMML0 == 0x54)//烤箱
                    {                      
                        if(RTMML1 == 0x3B)//启动
                        {
                            ToFace[0] = 0x50;
                            ToFace[1] = 0x05;                                
                            if(bakePara.tempr_set == 0)
                            {
                                send_selmode();
                            }
                            else
                            {
                                gb_Sendtianmao = 1;                                
                                respeak = PROMPT_SHUAIFENG_OPENWORK_STEAMER_MP3;   
                            }                            
                        }
                        else if(RTMML1 == 0x4A)//关闭
                        {
                            ToFace[0] = 0x50;
                            ToFace[1] = 0x06;                            
                            if(bakeCtrl.state == STA_NULL)
                            {
                                return;
                            }                                
                            gb_Sendtianmao = 1;                                
                            respeak = PROMPT_SHUAIFENG_ENDWORK_STEAMER_MP3; 
                        }
                        else if(RTMML1 == 0x04)//暂停
                        {
                            ToFace[0] = 0x50;
                            ToFace[1] = 0x07;                            
                            if(bakeCtrl.state == STA_NULL)
                            {
                                return;
                            }                                
                            gb_Sendtianmao = 1;                                
                            respeak = PROMPT_SHUAIFENG_SUSPENDWORK_STEAMER_MP3;                             
                        }                        
                    }
                    else if(RTMML0 == 0x78)//蒸箱
                    {                      
                        if(RTMML1 == 0x3B)//启动
                        {
                            ToFace[0] = 0x50;
                            ToFace[1] = 1;                                       
                            if(steamPara.tempr_set == 0)
                            {
                                send_selmode();
                                return;
                            }
                            else
                            {
                                gb_Sendtianmao = 1; 
                                respeak =  PROMPT_SHUAIFENG_OPENWORK_STEAMER_MP3;
                            }
                        }
                        else if(RTMML1 == 0x4A)//关闭
                        {
                            ToFace[0] = 0x50;
                            ToFace[1] = 2;                               
                            if(steamCtrl.state == STA_NULL)
                            {
                                return;
                            }
                            gb_Sendtianmao = 1;  
                            respeak =  PROMPT_SHUAIFENG_ENDWORK_STEAMER_MP3;  
                        }
                        else if(RTMML1 == 0x04)//暂停
                        {
                            ToFace[0] = 0x50;
                            ToFace[1] = 3;                               
                            if(steamCtrl.state == STA_NULL)
                            {
                                return;
                            }
                            gb_Sendtianmao = 1;  
                            respeak =  PROMPT_SHUAIFENG_SUSPENDWORK_STEAMER_MP3;                              
                        }     
                    }
                    else if(RTMML0 == 0x7E) //继续工作
                    {
                        if(RTMML1 == 0x98)
                        {
                            ToFace[0] = 0x50;
                            ToFace[1] = 9;                             
                            if((steamCtrl.state == STA_PAUSE)&&(door.sta == 0))//&& (gb_DryFireFlag == 0)&&(waterbox.sta == 0)
                            {
                                gb_Sendtianmao = 1;  
                                respeak =  PROMRT_SHUAIFENG_WORKKEEPON_MPS; 
                            } 
                            else if((bakeCtrl.state == STA_PAUSE)&&(doorbake.sta == 0))
                            {
                                gb_Sendtianmao = 1;                                
                                respeak = PROMRT_SHUAIFENG_WORKKEEPON_MPS;  
                            }
                        }
                    }
/*                     else if(RTMML0 == 0x54)  //蒸烤箱
                    {
                        if(RTMML1 == 0x3B)//启动蒸烤箱
                        {                                    
                            ToFace[0] = 0x50;
                            ToFace[1] = 5;                                       
                            if(steamPara.tempr_set == 0)
                            {
                                send_selmode();
                                return;
                            }
                            else
                            {
                                if((steamCtrl.state == STA_PAUSE)&&(door.sta == 0))
                                {
                                    if((gb_DryFireFlag||(waterbox.sta == BOX_OPEN)) && ((steamPara.menu == WORK_STEAMPURE)||(steamPara.menu == WORK_STEAMHOT)||
                                        (steamPara.menu == WORK_BBQWET)||(steamPara.menu == WORK_THAW)||(steamPara.menu == WORK_BABY)||((steamPara.menu == WORK_CHUJUN)&&(gu8_DisinfWorkStatus <= 1))))
                                        return;
                                    ToFace[0] = 0x50;
                                    ToFace[1] = 5;   
                                    gb_Sendtianmao = 1;  
                                    respeak =  PROMPT_SHUAIFENG_OPENWORK_STEAMER_MP3;
                                } 
                                else
                                {                                
                                    gb_Sendtianmao = 1; 
                                    respeak =  PROMPT_SHUAIFENG_OPENWORK_STEAMER_MP3;
                                }
                            }
                        }
                        else if(RTMML1 == 0x4A)//关闭蒸烤箱
                        {

                            if(steamCtrl.state == STA_NULL)
                            {
                                return;
                            }
                            ToFace[0] = 0x50;
                            ToFace[1] = 6;   
                            gb_Sendtianmao = 1;  
                            respeak =  PROMPT_SHUAIFENG_ENDWORK_STEAMER_MP3;                                    
                        }
                        else if(RTMML1 == 0x04)//暂停蒸烤箱
                        {

                            if((steamCtrl.state == STA_APPOINT)||(steamCtrl.state == STA_NULL))
                            {
                                return;
                            }
                            ToFace[0] = 0x50;
                            ToFace[1] = 7;   
                            gb_Sendtianmao = 1;  
                            respeak =  PROMPT_SHUAIFENG_SUSPENDWORK_STEAMER_MP3;  

                        }
                    }    
                    else if(RTMML0 == 0x7E) //继续工作
                    {
                        if(RTMML1 == 0x98)
                        {
                            if((steamCtrl.state == STA_PAUSE)&&(door.sta == 0))
                            {
                                if((gb_DryFireFlag||(waterbox.sta == BOX_OPEN)) && ((steamPara.menu == WORK_STEAMPURE)||(steamPara.menu == WORK_STEAMHOT)||
                                    (steamPara.menu == WORK_BBQWET)||(steamPara.menu == WORK_THAW)||(steamPara.menu == WORK_BABY)||((steamPara.menu == WORK_CHUJUN)&&(gu8_DisinfWorkStatus <= 1))))
                                    return;
                                ToFace[0] = 0x50;
                                ToFace[1] = 8;   
                                gb_Sendtianmao = 1;  
                                respeak =  PROMRT_SHUAIFENG_WORKKEEPON_MPS; 
                            } 

                        }

                    }  */  

                    // send_tianmao_comm();
                    // return;
                }
                break;                
                default:
                break;

            }
            send_tianmao_comm();            
        }            
        
    }
}
/****************************************
       发送数据中断
 ****************************************/
void Euart_send_byte_isr(void)
{
	u8 len;

	if (speak_comm.sending_f)
	{//没有发送中断或发送中断有问题时，在循环中发送帧内数据
		len = MAKEWORD(speak_comm.tx_buf[7],speak_comm.tx_buf[8]) + 12;						//*******

		speak_comm.tx_ct++;
		if (speak_comm.tx_ct < len)
		{
			// EUART_SendByte(speak_comm.tx_buf[speak_comm.tx_ct]);
            UART_SendByte(UART0, speak_comm.tx_buf[speak_comm.tx_ct]);  	            
		}
		else
		{
			speak_comm.tx_ct = 0;
			speak_comm.sending_f = false; 					//一帧数据发送完成
		}

		return;
 	}

    speak_comm.tx_ct = 0;
}
/****************************************
        接收数据
 ****************************************/
void Euart_recv_byte_isr(void)
{
	u8 euart_rx_data;
	u8 epacket_len = 0;

	/* Receive one date */
	// euart_rx_data = EUART_RecByte();		//
    euart_rx_data = UART_RecByte(UART0); 
	
  	if(!speak_comm.rx_byte_tmr) 							//
		  speak_comm.rx_ct = 0;			                //last recv byte timeout! reset recv!!!
	speak_comm.rx_byte_tmr = RX_RST_TIME;
	
	if (speak_comm.recved_f)
		return;
 		
  	if(!speak_comm.rx_ct)
  	{
  		if (euart_rx_data != 0x5A)
  			return;
	}

	if((speak_comm.rx_ct == 9)&&(!gb_TestFlag))
	{
		if (((MAKEWORD(speak_comm.rx_buf[7],speak_comm.rx_buf[8])) > (EUART_RX_BYTES-12)))
		{//err
			speak_comm.rx_ct = 0;
			return;
		}
	}

	speak_comm.rx_buf[speak_comm.rx_ct] = euart_rx_data;
	speak_comm.rx_ct++;	

    {
        if (speak_comm.rx_ct >= 9)
            epacket_len = MAKEWORD(speak_comm.rx_buf[7],speak_comm.rx_buf[8])+12;
        else
            return;
    }

	if (speak_comm.rx_ct >= epacket_len)
	{
		speak_comm.rx_ct = 0;   		//
		speak_comm.recved_f = true;    //	
	}
}
